<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_custlink.*" %>
<%@page import="java.util.*" %>

<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Map ti_custlink = new Hashtable();
	String s_cust_name = "";
	if(request.getParameter("search_cust_name")!=null && !request.getParameter("search_cust_name").equals("")){
		s_cust_name = request.getParameter("search_cust_name");
		ti_custlink.put("cust_name",s_cust_name);
	}
	String s_link_name = "";
	if(request.getParameter("search_link_name")!=null && !request.getParameter("search_link_name").equals("")){
		s_link_name = request.getParameter("search_link_name");
		ti_custlink.put("link_name",s_link_name);
	}
	String s_is_display= "";
	if(request.getParameter("search_is_display")!=null && !request.getParameter("search_is_display").equals("")){
		s_is_display = request.getParameter("search_is_display");
		ti_custlink.put("is_display",s_is_display);
	}
	String s_cust_type= "";
	if(request.getParameter("search_cust_type")!=null && !request.getParameter("search_cust_type").equals("")){
		s_cust_type = request.getParameter("search_cust_type");
		ti_custlink.put("cust_type",s_cust_type);
	}	
   	
	Ti_custlinkInfo ti_custlinkInfo = new Ti_custlinkInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_custlinkInfo.getListByPage(ti_custlink,Integer.parseInt(iStart),limit);
	int counter = ti_custlinkInfo.getCountByObj(ti_custlink);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?search_cust_name="+s_cust_name+
	"&search_link_name="+s_link_name+"&search_is_display="+s_is_display+"&iStart=",Integer.parseInt(iStart),limit);
	
	String para="search_cust_name="+s_cust_name+
	"&search_link_name="+s_link_name+"&search_is_display="+s_is_display+"&iStart="+Integer.parseInt(iStart);
%>
<html>
  <head>
    
    <title>会员友情链接管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="link.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>会员友情链接管理</h1>
			</td>

		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				会员名称:<input name="search_cust_name" id="search_cust_name" type="text" />

				链接名称:<input name="search_link_name" id="search_link_name" type="text" />
				会员类型:<select name="search_cust_type" id="search_cust_type">
				<option value="">请选择</option>
				<option value="0">企业</ option>	
				<option value="1">个人</ option>
				</select>				
				是否显示:<select name="search_is_display" id="search_is_display">
				<option value="">请选择</option>
				<option value="0">是</ option>	
				<option value="1">否</ option>
				</select>
				
				
				<input name="searchInfo" type="button"  onclick="search()" value="查询"/>
		
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
				<input class="buttab" name="searchInfo" type="button"  onclick="sortNews(this)" value="排序"/>	
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			<th>链接名称</th>
			<th>会员名称</th>
			
			<th>会员类型</th>
			
		  	
		  	
		  	<th>链接地址</th>

		  	<th>是否显示</th>
			<th>排序</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String link_id="",cust_id="",link_name="",link_url="",link_no="",is_display="",cust_name="";
					String is_display_str = "显示",cust_type="";
		  	if(map.get("link_id")!=null) link_id = map.get("link_id").toString();
			if(map.get("cust_type")!=null) cust_type = map.get("cust_type").toString();
			if(map.get("cust_name")!=null) cust_name = map.get("cust_name").toString();
			if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
			if(map.get("link_name")!=null) link_name = map.get("link_name").toString();
			if(map.get("link_url")!=null) link_url = map.get("link_url").toString();
			if(map.get("link_no")!=null) link_no = map.get("link_no").toString();
			String cust_type_string ="企业";
			if(cust_type.equals("1")){
			cust_type_string="个人";
			}
			
			if(map.get("is_display")!=null) {

				is_display = map.get("is_display").toString();
				
				if(is_display.equals("1")) {
					is_display_str = "不显示";
				}
				
				}	
		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=link_id %>" /></td>
				<td><a class="infotitle" href="updateInfo.jsp?link_id=<%=link_id %>&<%=para%>"><%=link_name%></a></td>
		  	<td><a href="javascript:searchByCustName('<%=cust_name%>');"><%=cust_name%></a></td>
			
			<td><a href="index.jsp?search_cust_type=<%=cust_type%>"><%=cust_type_string%></a></td>
		  	
		  
		  	
		  	<td><a href="<%=link_url%>" target="_blank"><%=link_url%></a></td>

			<td><a href="index.jsp?search_is_display=<%=is_display %>" ><%=is_display_str%></a></td>
			
			<td><input type="text" id="<%=link_id%>" name="<%=link_id%>" value="<%=link_no%>" size="4" maxlength="2" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"></td>
		  	
		  	
		  	
			<td width="10%"><a href="updateInfo.jsp?link_id=<%=link_id %>&<%=para%>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=link_id%>','2185');"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<script>
		function searchByCustName(cust_name){
			document.getElementById('search_cust_name').value=cust_name;
			document.indexForm.submit();
		}
	</script>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
				<input class="buttab" name="searchInfo" type="button"  onclick="sortNews(this)" value="排序"/>	
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="sort" id="sort" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="2185" />
	  </form>
</body>

</html>
